 <template>
	<view class="message-container">
		<view class="message-head" :style="{ paddingTop: barHeight + 'rpx' }">
			<view class="head-top">
				<image src="@/static/img/arr.png" mode="" @click="goto"></image>
				<text class="title">消息</text>
			</view>
			<view class="head-nav">
				<view :class="navIndex === index ? 'nav-item nav-item-active' : 'nav-item'"
				 v-for="(item, index) in data.navList"
				 :key="index"
				 @click="jumpNav(index)">{{ item.name }}</view>
			</view>
		</view>
		<view class="message-main-box">
			<view class="message-main">
				<scrollView
				 class='scroll'
				 :scrollBoolean="listData.total" 
				:scrollTop="listData.scrollTop"
				:scrollLoad="listData.total > listData.list.length" 
				:refresherRriggered="listData.refresherRriggered"
				@refresherrefresh="refresherrefresh" 
				@scrolltolower="scrolltolower">
				<view class="main-list">
					<view class="list-item"
					 v-for="(item, index) in listData.list"
					 :key="index">
						<image src="@/static/img/common/user.jpg" mode=""></image>
						<view class="info">
							<view class="info-top">
								<view class="top-name">{{ item.name }}</view>
								<view class="top-time">{{ item.time }}</view>
							</view>
							<view class="info-bt">{{ item.desc }}</view>
						</view>
					</view>
				</view>
				</scrollView>
			</view>
		</view>

	</view>
</template>

<script setup>
import { ref, reactive } from "vue"
import { onLoad } from '@dcloudio/uni-app'
import scrollView from "@/components/scrollView.vue";
import { getStatusBarHeight } from '@/utils/common/common.js'
const barHeight = ref(null)		
onLoad(_ => {
	barHeight.value = getStatusBarHeight()
})
// 数据
const data = reactive({
	navList: [
		{ name: '未读' },
		{ name: '已读' },
	]
})
// 列表数据
const listData = reactive({
	total: 20, //	总条数
	scrollTop: 0, //	滚动区域
	refresherRriggered: false, //	下拉状态
	pageInfo: { pageNum: 1, pageSize: 10 },
	list: [
		{ name: '宋女士', time: '12:14', desc: '您好，您的简历很符合我们的招聘条件，想的什么' },
		{ name: '宋女士', time: '12:14', desc: '您好，您的简历很符合我们的招聘条件，想的什么' },
		{ name: '宋女士', time: '12:14', desc: '您好，您的简历很符合我们的招聘条件，想的什么' },
		{ name: '宋女士', time: '12:14', desc: '您好，您的简历很符合我们的招聘条件，想的什么' },
		{ name: '宋女士', time: '12:14', desc: '您好，您的简历很符合我们的招聘条件，想的什么' },
	]
})
const navIndex = ref(0)
// 切换
const jumpNav = index => {
	navIndex.value = index
}
// 刷新
const refresherrefresh = _ => {
	console.log(122);
}
// 触底事件
const scrolltolower = _ => {
	console.log(1121212);
	// setTimeout( _=> {
	// 	listData.refresherRriggered = false
	// 	console.log(listData.refresherRriggered);
	// }, 1000)
	
}
// 返回上一页
const goto = _ => {
	uni.navigateBack()
}
</script>

<style lang="scss">
.message-container{
	height: 100vh;
	width: 100%;
	overflow: hidden;
	.message-head{
		width: 750rpx;
		// height: 431rpx;
		background: url('@/static/img/common/zgzbgs.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
		.head-top{
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			width: 750rpx;
			height: 88rpx;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			padding: 0 32rpx;
			box-sizing: border-box;
			image{
				width: 36rpx;
				height: 36rpx;
			}
			.title{
				width: 100%;
				flex: 1;
				font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
				font-weight: normal;
				font-size: 32rpx;
				color: #333333;
				line-height: 48rpx;
				// text-align: center;
				font-style: normal;
				text-transform: none;
				margin-left: 269rpx;
				
			}
		}
		.head-nav{
			width: 750rpx;
			// height: 98rpx;
			// background: #FFFFFF;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			display: flex;
			align-items: center;
			// justify-content: space-between;
			padding: 24rpx 32rpx;
			box-sizing: border-box;
			margin-top: 27rpx;
			.nav-item{
				font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
				font-weight: normal;
				font-size: 28rpx;
				color: #595959;
				// line-height: 42rpx;
				text-align: left;
				font-style: normal;
				text-transform: none;
				margin: 0 10rpx;
			}
			.nav-item-active{
				color: #6B64D3;
				font-weight: bold;
			}
		}
	}
	.message-main-box{
		height: calc(100% - 260rpx);
		padding: 24rpx 13rpx;
		box-sizing: border-box;
		
		.message-main{
			background: #FFFFFF;
			border-radius: 24rpx 24rpx 24rpx 24rpx;
			.scroll{
				width: 100%;
				height: 100%;
				.main-list{
					width: 100%;
					height: 100%;
					padding: 28rpx 24rpx;
					box-sizing: border-box;
					.list-item{
						width: 100%;
						display: flex;
						align-items: center;
						margin-bottom: 60rpx;
						image{
							width: 96rpx;
							height: 96rpx;
							border-radius: 50%;
						}
						.info{
							width: 80%;
							margin-left: 16rpx;
							.info-top{
								display: flex;
								align-items: center;
								justify-content: space-between;
								.top-name{
									font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
									font-weight: normal;
									font-size: 36rpx;
									color: #262626;
									line-height: 54rpx;
									text-align: left;
									font-style: normal;
									text-transform: none;
								}
								.top-time{
									font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
									font-weight: normal;
									font-size: 28rpx;
									color: #8C8C8C;
									line-height: 42rpx;
									text-align: left;
									font-style: normal;
									text-transform: none;
								}
							}
							.info-bt{
								// width: calc(100% - 100rpx);
								font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
								font-weight: normal;
								font-size: 28rpx;
								color: #8C8C8C;
								line-height: 42rpx;
								text-align: left;
								font-style: normal;
								text-transform: none;
								margin-top: 8rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							}
						}
					}
				}
				
			}
		}
	}

}
</style>
